﻿using MaterialDesignThemes.Wpf;
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Markup;

namespace VIA.Presentation.Converters
{
    class CameraIconKindIsAccessibleMultiConverterConverter : MarkupExtension, IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values[0] is bool isAccessible && values[1] is bool isConnected && values[2] is string serialNumber1 && values[3] is string serialNumber2)
            {
                if (isAccessible)
                {
                    return PackIconKind.Camera;
                }
                else
                {
                    if (isConnected && serialNumber1 == serialNumber2)
                    {
                        return PackIconKind.Camera;
                    }
                    else
                    {
                        return PackIconKind.CameraOff;
                    }
                }
            }
            else
                return PackIconKind.Camera;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            return this;
        }

    }
}
